clear
set more off
cap log close
set logtype text

clear
set more off
cap log close
set logtype text

***** CHANGE TO OWN HOME DIRECTORY
global homedir "~/Dropbox/intgmob_AssortativeMating"

**** 
global maindir "$homedir/ReplicationPackage/Appendix_A"
global maintextdatdir "$homedir/ReplicationPackage/intermediatedata"
global rawdir "$maindir/raw_data"
global tempdir "$maindir/temp_data"
global datdir "$maindir/generated_data"
global outputdir "$maindir/output"

local max = 10
local iter_per_file = 5

use "$datdir/res1.dta", clear
forvalues i=2/`max' {
	append using "$datdir/res`i'.dta"
}

gen true_iteration = (file_num - 1)*`iter_per_file' + iteration

tab true_iteration

log using "$outputdir/tableA-5.txt", replace	
table sigma2_ses sigma2_con , c(mean beta_q4)	
log close	
	
log using "$outputdir/tableA-6.txt", replace		
table sigma2_ses sigma2_con , c(mean var_pseudo)
log close

log using "$outputdir/tableA-7.txt", replace	
table sigma2_ses sigma2_con , c(mean rsquared)
log close

log using "$outputdir/tableA-8.txt", replace	
table sigma2_ses sigma2_con , c(mean share50)
log close

